function demo<T extends NeedLength>(a: T) {
    console.log(a.length);
}


interface NeedLength {
    length: number
}

interface User{
    name: string
    age: number
    length: number
}

let u: User = {
    name: "小花",
    age: 18,
    length: 10
}

demo<User>(u)